import { Component, OnInit } from '@angular/core';

import { LoginService, Principal, Account } from 'app/core';
import { VERSION } from 'app/app.constants';

@Component({
    selector: 'jhi-home',
    templateUrl: './home.component.html',
    styleUrls: ['home.css']
})
export class HomeComponent implements OnInit {
    account: Account;
    version: string;
    images = [];

    constructor(private principal: Principal, private loginService: LoginService) {}

    ngOnInit() {
        this.principal.identity().then(account => {
            this.account = account;
        });

        this.version = VERSION ? VERSION : '';
        this.images[0] = './contents/images/platform-concept.jpg';
        this.images[1] = './contents/images/platform-techstack.jpg';
        this.images[1] = './contents/images/platform-architecture.jpg';
    }

    isAuthenticated() {
        return this.principal.isAuthenticated();
    }

    login() {
        this.loginService.login();
    }
}
